package com.desheng.bigdata.flink.stream.source

import org.apache.flink.streaming.api.scala.{DataStream, StreamExecutionEnvironment}

/**
  * 基于socket的方式来读取数据
  */
object _01SourceFromSocket {
    def main(args: Array[String]): Unit = {
        val env = StreamExecutionEnvironment.getExecutionEnvironment


        val lines:DataStream[String] = env.socketTextStream(
                            "bigdata01", 9999,
                            delimiter = ',',
                            maxRetry = 3
                        )

        lines.print("socket")

        env.execute(s"${_01SourceFromSocket.getClass.getSimpleName}")
    }
}
